From e829d8bac8be98b18c16bd0f41c9530cffbf9b6a Mon Sep 17 00:00:00 2001 From: Anthony PERARD Date: Mon, 23 Jul 2018 12:20:24 +0100 Subject: [PATCH] libxl_dm: Add libxl__qemu_qmp_path() MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit ... which generates the path to a QMP socket that libxl uses. Signed-off-by: Anthony PERARD Reviewed-by: Roger Pau Monné Acked-by: Wei Liu --- tools/libxl/libxl_dm.c | 4 ++-- tools/libxl/libxl_internal.h | 4 ++++ 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/tools/libxl/libxl_dm.c b/tools/libxl/libxl_dm.c index 70e8b16c2d..abd31ee6f2 100644 --- a/tools/libxl/libxl_dm.c +++ b/tools/libxl/libxl_dm.c @@ -946,8 +946,8 @@ static int libxl__build_device_model_args_new(libxl__gc *gc, flexarray_append(dm_args, "-chardev"); flexarray_append(dm_args, GCSPRINTF("socket,id=libxl-cmd," - "path=%s/qmp-libxl-%d,server,nowait", - libxl__run_dir_path(), guest_domid)); + "path=%s,server,nowait", + libxl__qemu_qmp_path(gc, guest_domid))); flexarray_append(dm_args, "-no-shutdown"); flexarray_append(dm_args, "-mon"); diff --git a/tools/libxl/libxl_internal.h b/tools/libxl/libxl_internal.h index 72ab177ce5..1bc9394135 100644 --- a/tools/libxl/libxl_internal.h +++ b/tools/libxl/libxl_internal.h @@ -4424,6 +4424,10 @@ static inline bool libxl__string_is_default(char **s) _hidden int libxl__prepare_sockaddr_un(libxl__gc *gc, struct sockaddr_un *un, const char *path, const char *what); +static inline const char *libxl__qemu_qmp_path(libxl__gc *gc, int domid) +{ + return GCSPRINTF("%s/qmp-libxl-%d", libxl__run_dir_path(), domid); +} #endif /* -- 2.30.2